<?php //debug($err);?>
<a class="isHidden showMenu" title="show menu bar" href="#">Show Menu</a>
<?php  $cl='pair' ?>
<div class="filterForms">
    <?php echo $this->Html->link('s',array('action'=>'filterForms'),array('class'=>'search','title'=>__('Filter Forms',true),'rel'=>'details','dmdcode'=>'Filter Forms'));  ?>
    <?php echo $this->Html->link('s',array('action'=>'showForms'),array('class'=>'showForms','title'=>__('remove filter',true)));  ?>
    <?php echo $this->Html->link('s',array('action'=>'showForms',1),array('class'=>'hideClosed','title'=>__('hide closed forms',true)));  ?>
    <a class="hideMenu" title="hide menu bar" href="#"><?php __('hide Menu')  ?></a>
</div>

<table class="formstatus">
    <thead>
        <tr>
            <th><?php __('Demand form')  ?></th>
            <th><?php __('Type')  ?></th>
            <th><?php __('Date')  ?></th>
            <th><?php __('Demander')  ?></th>
            <th><?php __('Status')  ?></th>
            <th><?php __('Actions')  ?></th> 
        </tr>
    </thead>
    <tbody>
<?php $i=1;foreach ($forms as $form): ?>
        <?php (($i%2)>0)?$cl='impair':$cl='pair';  ?>
        <?php ($form['Dmdformstatus']['id']==5)?$cl='eico':$cl=$cl;  ?>
        <?php ($form['Dmdformstatus']['id']==9)?$cl='problem':$cl=$cl;  ?>
        <?php ($form['Dmdformstatus']['id']==10)?$cl='closed':$cl=$cl;  ?>
        <tr class="<?php echo $cl  ?>">
            <?php if(in_array($this->Session->read('Auth.User.group_id'),array(1,2,3)) || ($this->Session->read('Auth.User.id')==$form['Dmdform']['manager_id'] && $this->Session->read('Auth.User.group_id')==5 && $form['Dmdform']['manager_visa']==0 && in_array($form['Dmdformstatus']['id'],array(7,1))) ):  ?>
            <td><?php echo $this->Html->link($form['Dmdform']['code'],array('controller'=>'dmdforms','action'=>'newDmdform','1',$form['Dmdform']['id']),array('class'=>'editDmdform','title'=> __('Modify Demand',true)));  ?></td>
            <?php else:  ?>
            <td><?php echo $form['Dmdform']['code']  ?></td>
            <?php endif;  ?>
            <td><?php echo $form['Dmdformtype']['title']  ?></td>
            <td><?php echo $form['Dmdform']['form_date']  ?></td>
            <td><?php echo $form['Demander']['UsName']  ?></td>
            <td><?php echo $form['Dmdformstatus']['title']  ?></td>
            <td><?php
                echo $this->Html->link('d',array('action'=>'showDmdformDetails',$form['Dmdform']['id'],$form['Dmdformtype']['id']),array('class'=>'DmdformDetails','title'=> __('Details',true) ,'rel'=>'details','dmdcode'=>$form['Dmdform']['code']));
                echo $this->Html->link('s',array('action'=>'showStatusChange',$form['Dmdform']['id'],$form['Formstatus']['id']),array('class'=>'StatusChange','rel'=>'details','title'=> __('Change Status',true) ,'dmdcode'=>$form['Dmdform']['code']));
                echo $this->Html->link('f',array('action'=>'showFormStatus',$form['Formstatus']['id']),array('class'=>'FormStatusChange','title'=>'Form Statuses Details','rel'=>'details','dmdcode'=>$form['Dmdform']['code']));               
                echo $this->Html->link('f',array('action'=>'deleteForm',$form['Formstatus']['id'],$form['Dmdform']['id']),array('class'=>'FormDelete','title'=> __('Delete form',true) ), sprintf(__('Are you sure you want to delete the form : %s ?', true),$form['Dmdform']['code']));
            ?></td>
        </tr>
<?php  $i++;endforeach; ?>
    </tbody>
</table>
<div class="paginate">
	<?php
	echo $this->Paginator->counter(array(
	'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
	));
	?>	

	<div class="paging">
		<?php echo $this->Paginator->prev( __('previous', true), array(), null, array('class'=>'prev'));?>
	 | 	<?php echo $this->Paginator->numbers();?>
 |
		<?php echo $this->Paginator->next(__('next', true), array(), null, array('class' => 'next'));?>
	</div>
    </div>


